From aa0eb39186070bf559c4e79dbb984afb9ae4bb07 Mon Sep 17 00:00:00 2001 From: robertlipe Date: Thu, 3 Oct 2013 00:43:34 +0000 Subject: [PATCH] Fix leak I introdued in new "obvious" code yesterday. Brace ourselves for more of these soon... --- gpsbabel/defs.h | 2 +- gpsbabel/mkshort.cc | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/gpsbabel/defs.h b/gpsbabel/defs.h index 75d50d8c3..98cabc210 100644 --- a/gpsbabel/defs.h +++ b/gpsbabel/defs.h @@ -773,7 +773,7 @@ typedef mkshort_handle_imp* short_handle; #ifndef DEBUG_MEM char* mkshort(short_handle, const char*); -char* mkshort(short_handle, const QString&); +QString mkshort(short_handle, const QString&); short_handle mkshort_new_handle(void); #else char* MKSHORT(short_handle, const char*, DEBUG_PARAMS); diff --git a/gpsbabel/mkshort.cc b/gpsbabel/mkshort.cc index cd1a8aa9d..7bd919e8b 100644 --- a/gpsbabel/mkshort.cc +++ b/gpsbabel/mkshort.cc @@ -572,10 +572,13 @@ mkshort(short_handle h, const char* istring) return ostring; } -char * +QString mkshort(short_handle h, const QString& istring) { - return mkshort(h, CSTR(istring)); + char *t = mkshort(h, CSTR(istring)); + QString r(t); + xfree(t); + return r; } /* -- 2.30.2